package com.ruoyi.app.controller.sys.controller;

import com.ruoyi.app.common.annotation.PassToken;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.CmsArticle;
import com.ruoyi.system.service.ICmsArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/article")
public class CmsArticleController extends BaseController implements ApiController<CmsArticle> {

    @Autowired
    private ICmsArticleService cmsArticleService;


    @PassToken
    @Override
    public TableDataInfo list(CmsArticle cmsArticle) {
        startPage();
        List<CmsArticle> cmsArticleList = cmsArticleService.selectCmsArticleList(cmsArticle);
        return getDataTable(cmsArticleList);
    }

    @Override
    public CmsArticle getOne(Long id) {
        CmsArticle cmsArticle = cmsArticleService.selectCmsArticleById(id);
        return cmsArticle;
    }
}
